from pathlib import Path
import os

root=Path(__file__).parent

# dirs=os.listdir(root)
for dir in os.listdir(root):
    if os.path.isdir(dir)==False:
        continue
    sub_dirs=os.listdir(dir)
    if 'migrations' not in sub_dirs:
        continue
    target_dir=os.path.join(dir,'migrations')
    files=os.listdir(target_dir)
    for file in files:
        file_path=os.path.join(target_dir,file)
        if '__init__' in file or os.path.isdir(file_path):
            continue
        os.remove(file_path)


if __name__=='__main__':
    pass